

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<head>
    <title>登录页</title>
    <link rel="stylesheet" href="resources/css/common.css">
    <link rel="stylesheet" href="resources/css/blog-login.css">

</head>
<body class="bg">
<!-- 导航栏 -->
<div class="nav">
    <img src="resources/image/log.png" alt="">
    <span class="title">我的博客系统</span>
    <!-- 使用 span 把左右两侧的元素给撑开 -->
    <span class="spacer"></span>
    <a href="index">主页</a>
    <a href="login.jsp">登录</a>

</div>
<% Object rmessage = request.getAttribute("Rmessage");
if (rmessage==null){
    rmessage="";
}
%>
<h2>反馈信息：<%=rmessage%></h2>
<!-- 登录页面的版心 -->
<div class="login-container">
    <div class="login-dialog">
        <form action="register" method="post" onsubmit="return check(this)" >
            <h3>用户注册</h3>
            <div class="row1">
                <span>用户名</span>
                <input type="text" id="username" name="username">
            </div>
            <div class="row1">
                <span>密码</span>
                <input type="password" name="password">
            </div>
            <div class="row1">
                <span>确认密码</span>
                <input type="password"  name="confirmPassword">
            </div>

            <div class="row2 ">

                <a href="login.jsp"><input class="row3" type="button" value="登陆" id="submit"></a>
                <input class="row3" type="submit" value="提交" id="submit">

            </div>


        </form>
    </div>

</div>
    <script>
      function  check(form){
          let password = form.password.value;
          let confirmPassword = form.confirmPassword.value
          let username = form.username.value

          if (username===""){
              alert("用户名不能为空")
              return false;
          }
          if (password===""){
              alert("密码不能为空")
              return false;
          }
          if (password!==confirmPassword){
              alert("两次密码不相同")
              return  false
          }
          return true

      }
    </script>
</body>

</html>

